package nio.engine;

import nio.engine.ConnectCallback;
import nio.engine.NioChannel;

public class ConnectCallbackImplementation implements ConnectCallback{

	public ConnectCallbackImplementation() {
	}

	@Override
	public void closed(NioChannel nioChannel) {
		System.out.println("NioChannel at " + nioChannel.getRemoteAddress() + " is now closed");
	}

	@Override
	public void connected(NioChannel nioChannel) {
		System.out.println("Connected to : " + nioChannel.getRemoteAddress());

		String message = "ping-pong !";
		nioChannel.send(message.getBytes(), 0, message.getBytes().length);
	}

}
